package com.yc.hotel.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yc.hotel.dto.RoomTypeDTO;
import com.yc.hotel.entity.RoomType;
import com.yc.hotel.mapper.IRoomTypeMapper;
import com.yc.hotel.service.IRoomTypeService;
import com.yc.hotel.util.StringUtil;

@Service
public class RoomTypeServiceImpl implements IRoomTypeService{
	
	@Autowired
	private IRoomTypeMapper roomTypeMapper;

	@Override
	public int add(RoomType rt) {
		if(!StringUtil.checkNull(rt)) {
			return roomTypeMapper.add(rt);
		}
		return -1;
	}

	@Override
	public int update(RoomType rt) {
		if(!StringUtil.checkNull(rt)) {
			return roomTypeMapper.update(rt);
		}
		return -1;
	}

	@Override
	public List<RoomType> findByPage(Map<String, Object> map) {
		if(StringUtil.checkNull(map)){
			return null;
		}
		return roomTypeMapper.findByPage(map);
	}

	@Override
	public int total(Map<String, Object> map) {
		return roomTypeMapper.total(map);	
	}

	@Override
	public List<RoomType> finds(Map<String, Object> map) {
		return roomTypeMapper.finds(map);
	}

	@Override
	public List<RoomTypeDTO> findsF(Map<String, Object> map) {
		return roomTypeMapper.findsF(map);
	}

}
